// 用户相关类型定义 - 与后端User实体保持一致

// 地址信息
export interface Address {
  id: string
  name: string
  phone: string
  province: string
  city: string
  district: string
  street: string
  detail: string
  postcode: string
  isDefault: boolean
  tag: string
  createdTime: string
  updatedTime: string
}

// 用户实体（完整信息，与后端User一致）
export interface User {
  id: number
  username: string
  password?: string
  name?: string
  avatar?: string
  sex?: number // 0:未知,1:男,2:女
  birthday?: string
  phone?: string
  email?: string
  addresses?: Address[]
  userType?: string // admin:管理员,user:会员,ban:封号
  memberLevel?: number // 0:黑金,1:白金,2:普通
  totalSpent?: number
  currentYearSpent?: number
  orderCount?: number
  levelUpgradeTime?: string
  enabled?: number // 0:禁用,1:启用
  loginTimes?: number
  lastLoginTime?: string
  isDel?: number
  createdTime?: string
  updateTime?: string
}

// 用户视图对象（前端展示，与后端一致使用下划线命名）
export interface UserVO {
  id: number
  username: string
  name?: string
  avatar?: string
  sex?: number
  birthday?: string
  phone?: string
  email?: string
  addresses?: Address[]
  userType?: string          
  memberLevel?: number       
  totalSpent?: number        
  currentYearSpent?: number  
  orderCount?: number        
  levelUpgradeTime?: string  
  enabled?: number
  loginTimes?: number        
  lastLoginTime?: string     
  createdTime?: string      
  updateTime?: string       
}

// 登录用户信息（与后端LoginUserVO一致）
export interface LoginUserVO {
  id: number | string       // 后端Long类型，JSON序列化后可能是number或string
  username: string
  name?: string
  avatar?: string
  userType?: string         
  memberLevel?: number      
  // 其他登录相关信息
}

// 登录请求（与后端UserLoginRequest一致）
export interface UserLoginRequest {
  account: string
  password: string
}

// 注册请求（与后端UserRegisterRequest一致）
export interface UserRegisterRequest {
  username: string
  password: string
  checkPassword: string
}

// 用户更新请求
export interface UserUpdateRequest {
  id: number
  username?: string
  name?: string
  avatar?: string
  sex?: number
  birthday?: string
  phone?: string
  email?: string
  addresses?: Address[]
  userType?: string         
  memberLevel?: number      
  totalSpent?: number       
  currentYearSpent?: number 
  enabled?: number
}

// 用户查询请求
export interface UserQueryRequest {
  current: number
  pageSize: number
  keyword?: string
  userType?: string
  enabled?: number
}

// 删除请求
export interface DeleteRequest {
  id: number
} 